<template>
  <div class="">
    <h4>这是子组件1</h4>
     <h1>来自vuex的数据{{ $store.state.msg }}</h1>
    <button @click="postchild2">把msg传给child2</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      msg: "这是child1的数据，要传递给child2的数据",
    };
  },
  mounted() {},
  methods: {
    postchild2() {
      this.$bus.$emit("getdata", this.msg);
    },
  },
  components: {},
};
</script>

<style lang="scss"></style>
